package com.powernode.client;

import com.powernode.annotation.Component;

public class ReflectAnnotationTest1 {
    public static void main(String[] args) throws Exception{
        //通过反射机制读取注解
        Class<?> aClass = Class.forName("com.powernode.bean.User");
        //判断类上面有没有注解
        if (aClass.isAnnotationPresent(Component.class)) {
            Component annotation = aClass.getAnnotation(Component.class);
            String value = annotation.value();
            System.out.println(value);
        }
    }
}
